package org.weso.acota.enhacer;

import org.apache.log4j.Logger;
import org.weso.acota.dao.SuggestDAO;
import org.weso.acota.dao.SuggestNplDAOImpl;
import org.weso.acota.to.ProviderTO;

/**
 * @autor weena
 * 
 * */

public class OpenNLPEnhancer extends EnhancerAdapter {

	private static SuggestDAO openNLPDAO = new SuggestNplDAOImpl();
	protected static Logger logger = Logger.getLogger(OpenNLPEnhancer.class);
	
	@Override
	protected void execute() throws Exception {
		logger.info("Access to OpenNLP analysis");
		this.suggest = openNLPDAO.suggest(this.request);
	}

	@Override
	protected void preExecute() throws Exception {
		// TODO Auto-generated method stub
	}

	@Override
	protected void postExecute() throws Exception {
		logger.debug("Add providers to request");
		this.request.getTargetProviders().add(openNLPDAO.getProvider());
		logger.debug("Add suggestons to request");
		this.request.setSuggestions(suggest);
	}
	
	public static ProviderTO getDefaultProvider() throws Exception {
		logger.info("Get openNLP provider");
		return openNLPDAO.getProvider();
	}

}
